# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=air
pkgver=2.0.0
pkgrel=9
pkgdesc='A GUI front-end to dd/dc3dd designed for easily creating forensic images.'
url='https://sourceforge.net/projects/air-imager/'
groups=('blackarch' 'blackarch-forensic')
license=('GPL')
arch=('any')
depends=('perl-tk' 'sharutils')
source=("http://downloads.sourceforge.net/air-imager/air-$pkgver.tar.gz")
sha512sums=('3b22b0b2f07fd5bf89b576bb1d96d9bc372534f2063e99c7a9c4931fd927b0cc5c3fe832f0c0d51ceb95fe242fd0d3e4fe6bf59339dd2971b6afcd00106ea92c')
install="$pkgname.install"

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/var/log"

  export PERLTK_VER=$(pacman -Q perl-tk | awk -F' ' '{ print $2 }' |
  sed -e 's/-.*//' -e 's/_//')

  INTERACTIVE="no" INSTALL_DIR="$pkgdir/usr" TEMP_DIR="$srcdir/" \
    FINAL_INSTALL_DIR=/usr ./install-air-$pkgver

  chown -R root:root $pkgdir/*

  mv "$pkgdir/usr/share/$pkgname/logs" "$pkgdir/var/log/$pkgname"
  ln -s "/var/log/$pkgname" "$pkgdir/usr/share/$pkgname/logs"
  chmod ug+rwx "$pkgdir/var/log/$pkgname"

  if [[ -p "$pkgdir/usr/share/$pkgname/air-fifo" ]]; then
    chmod ug+rw "$pkgdir/usr/share/air/air-fifo"
  fi

  chmod +xr "$pkgdir/usr/bin/$pkgname"
}

